package one.four.twentySix;

import java.util.Arrays;

public class ThreePoint {

	public static int ct(int[][] a) {
		int res = 0;
		for (int i = 0; i < a.length; i++) {
			for (int j = i + 1; j < a.length; j++) {
				for (int m = j + 1; m < a.length; m++) {
					int x1 = a[i][0];
					int y1 = a[i][1];

					int x2 = a[j][0];
					int y2 = a[j][1];

					int x3 = a[m][0];
					int y3 = a[m][1];

					if (x1 == x2 && x2 == x3) {
						res++;
					} else {
						double k1 = (double) ((double) (y1 - y2)) / ((double) (x1 - x2));
						double k2 = (double) ((double) (y2 - y3)) / ((double) (x2 - x3));

						if (x1 != x2 && x2 != x3 && k1 == k2) {
							res++;
							System.out.println(
									Arrays.toString(a[i]) + "," + Arrays.toString(a[j]) + "," + Arrays.toString(a[m]));
						}
					}

				}
			}
		}
		return res;
	}

	public static void main(String[] args) {
		int[][] a = { { 1, 1 }, { 2, 2 }, { 3, 3 }, { 4, 5 } };
		int r = ct(a);

		System.out.println(r);
	}

}
